package com.sportschain.app.shop.activity;

import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.sportschain.app.R;
import com.sportschain.app.core.base.BaseActivity;
import com.sportschain.app.shop.adapter.CommodityAdapter;
import com.sportschain.app.shop.bean.CommodityBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class StoreDetailActivity extends BaseActivity {


    @BindView(R.id.commodity_rv)
    RecyclerView mCommodityRv;

    private CommodityAdapter mAdapter;

    @Override
    public int getLayoutId() {
        return R.layout.activity_store_detail;
    }

    @Override
    public void initView() {
        mAdapter = new CommodityAdapter();
        mAdapter.bindToRecyclerView(mCommodityRv);
        mAdapter.setEmptyView(R.layout.empty_view_layout);
    }

    @Override
    public void initData() {
        List<CommodityBean> data = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            data.add(new CommodityBean());
        }
        mAdapter.setNewData(data);
    }

    @Override
    public void initListener() {
        mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                startActivity(CommodityDetailActivity.class);
            }
        });
    }
}
